<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
         *{
            margin: 0;
            padding: 0;
            list-style: none;
        }
        html,body{
            width: 100%;
            height: 100%;
        }
        .box{
            width: 1000px;
            margin: 0 auto;
        }
        .item{
            margin-top: 10px;
            height: 150px;
            width: 1000px;
            display: flex;
            justify-content: space-around;
            align-items: center;
            border: 1px solid #ccc;
        }
    </style>
    <script src="../lib/axios.js"></script>
</head>

<body>
    <h1>书籍详情</h1>
    <div class="box">

    </div>
    <script>
        let index = localStorage.getItem('index');
        axios.get(`/book/index/${index}`).then((res) => {
            console.log(res.data);
            fn(res.data)
        })
        let box = document.querySelector('.box');
        function fn(arr) {
            console.log(arr);
            
            box.innerHTML = arr=` <div class="item">
            <img src="${arr.img}" alt="">
            <div>
                <p>${arr.name}</p>
                <p>${arr.author}</p>
                <p>${arr.info}</p>
                <p>${arr.lTime}</p>
            </div>
            <div>
                <p>${arr.count}票</p>
                <button>书籍详情</button>
                <button>加入书架</button>
            </div>
        </div>`
        }
    </script>
</body>

</html>